<?php $tpl->addJS('javascript/jquery/jquery.js'); ?>
<div class="task">
<?php include ('buttons.tpl'); ?>
</div>

<?php if ($error) { ?>
<div class="warning"><?php echo $error; ?></div>
<?php } ?>
<?php if ($message) { ?>
<div class="message"><?php echo $message; ?></div>
<?php } ?>
<h2><?php echo $heading_title; ?></h2>
<div class="description"><?php echo $heading_description; ?></div>
<div id="list">
  <table class="a">
    <tr>
      <td class="c"><?php echo $text_results; ?></td>
      <td class="d"><form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
          <?php echo $entry_page; ?>
          <select name="page" onchange="this.form.submit();">
		<?php foreach ($pages as $p) { ?>
		<option value="<?php echo $p['value']; ?>"<?php if ($p['value'] == $page) { ?> selected="selected"<?php } ?>><?php echo $p['text']; ?></option>
		<?php } ?>
          </select>
        </form></td>
      <td class="e"><form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
          <?php echo $entry_search; ?>
          <input type="input" name="search" value="<?php echo $search; ?>" />
        </form></td>
    </tr>
  </table>
  <form action="<?php echo @$listaction; ?>" method="post" enctype="multipart/form-data">
  <table class="list">
    <tr>
      <?php foreach ($cols as $col) { ?>
      <th class="<?php echo $col['align']; ?>">
      
      <?php if (isset($col['name'])) { ?>
        <?php if (isset($col['href'])) { ?>
         <a href="<?php echo @$col['href']; ?>"><?php echo $col['name']; ?></a>
          <?php if ($sort == $col['sort']) { ?>
          <?php if ($order == 'asc') { ?>
          &nbsp;<img src="<?php echo $tpl->getImage('image/asc.png'); ?>" class="png" />
          <?php } else { ?>
          &nbsp;<img src="<?php echo $tpl->getImage('image/desc.png'); ?>" class="png" />
          <?php } ?>
          <?php } ?>
        <?php } else { ?>
          <?php echo $col['name']; ?>
        <?php } ?>
      <?php } ?>
      <?php //} ?>

        <?php //} ?>
        <?php //} ?>
      </th>
      <?php } ?>
    </tr>
    
    <?php $j = 1; ?>
    <?php if (isset($previous)) { ?>
    <tr class="row1" onmouseover="this.className='previous'" onmouseout="this.className='row1'" onclick="self.location.href='<?php echo $previous; ?>'">
      <td><img src="<?php echo $tpl->getImage('image/previous.png'); ?>" class="png" />&nbsp;<?php echo $text_previous; ?></td>
      <?php for ($i = 1; $i < sizeof($cols); $i++) { ?>
      <td>&nbsp;</td>
      <?php $j = 0; ?>
      <?php } ?>
    </tr>
    <?php } ?>
    <?php foreach ($rows as $row) { ?>
	  <?php if($j != 1) {$j = 1;}else{$j = 0;} ?>
		<?php if($j == 0) {$class = 'row1';}elseif($j == 1){$class = 'row2';}	?>
    <tr class="<?php echo $class; ?>" onmouseover="this.className='highlight'" onmouseout="this.className='<?php echo $class; ?>'">
      <?php foreach ($row['cell'] as $cell) { ?>
      <?php if (isset($cell['value'])) { ?>
      <td class="<?php echo $cell['align']; ?>"><?php echo $cell['value']; ?>
        <?php if (@$cell['default']) { ?>
        <b>(<?php echo $text_default; ?>)</b>
        <?php } ?></td>
      <?php } elseif (isset($cell['image'])) { ?>
      <td id="ximg" class="<?php echo $cell['align']; ?>"><img src="<?php echo $cell['image']; ?>" /></td>
      <?php } elseif (isset($cell['path'])) { ?>
      <td width="30" class="<?php echo $cell['align']; ?>"><a href="<?php echo $cell['path']; ?>"><img src="<?php echo $tpl->getImage('image/'.$cell['icon']); ?>" class="png" /></a></td>
      <?php } elseif (isset($cell['icon'])) { ?>
      <td class="<?php echo $cell['align']; ?>"><?php if (isset($cell['href'])) { ?>
        <a href="<?php echo $cell['href']; ?>"><img src="<?php echo $tpl->getImage('image/'.$cell['icon']); ?>" class="png" /></a>
        <?php } else { ?>
        <img src="<?php echo $tpl->getImage('image/'.$cell['icon']); ?>" class="png" />
        <?php } ?>
      </td>
      <?php } elseif (isset($cell['action'])) { ?>
      <td class="<?php echo $cell['align']; ?>"><?php foreach ($cell['action'] as $action) { 
		if (preg_match('/action=delete/',$action['href'])) { $action['href'].='" onClick="return confirm(\'Are you sure you want to delete?\')'; }
		if (preg_match('/action=uninstall/',$action['href'])) { $action['href'].='" onClick="return confirm(\'Are you sure you want to uninstall?\')'; }
      ?>
        <a href="<?php echo $action['href']; ?>"><img src="<?php echo $tpl->getImage('image/'.$action['icon']); ?>" alt="<?php echo $action['text']; ?>" title="<?php echo $action['text']; ?>" class="png" /></a>
        <?php } ?></td>
      <?php } ?>
      <?php } ?>
    </tr>
    <?php } ?>
    </table>
    <?php if (isset($selectbox)) { ?>
    <table width="100%">
    <tr>
    <td align="right" colspan="<?php echo $colspan; ?>"><select name="listcmd">
  	<?php foreach ($selectbox as $sb) { ?>
    <option><?php echo $sb; ?></option>
  	<?php } ?>
  	</select>
  	<input class="button_submit" type="submit" name="submit" onClick="return confirm('Are you sure you want to do this?')" value="Go" />
  	</td>
  	</tr>
  	</table>
  	<?php } ?>
  	</form>
  
</div>